home *** CD-ROM | disk | FTP | other *** search
- Path: newshub.sdsu.edu!ucsnews!rohan!weikel
- From: weikel@rohan.sdsu.edu (weikel)
- Newsgroups: comp.lang.c++
- Subject: Mod or if?
- Date: 9 Feb 1996 18:25:58 GMT
- Organization: San Diego State University Computing Services
- Message-ID: <4fg3jm$fb8@gondor.sdsu.edu>
- NNTP-Posting-Host: 130.191.143.100
-
- Which is better?
-
- x = (x mod 7);
-
- or
-
- if (x == 7) x = 0;
-
- in terms of performance? I know that the mod function is slow
- ,but the if method seems brute-forceish.
-
-